<%@page import="com.wanmait.hotelManage.vo.Room"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
    String path=request.getContextPath();
    Room room=(Room)request.getAttribute("room");
    %>
<div id="pagediv">               
                    
                    <table class="result-tab" width="100%">
                        <tr>
                            <th class="tc" width="5%"><input class="allChoose" name="" type="checkbox"></th>
                            <th>序号</th>
                            <th>客房号</th>
                            <th>标题</th>
                            <th>价格</th>
                            <th>折扣价格</th>
                            <th>状态</th>
                            <th>入住人员信息详情</th>
                            <th>操作</th>
                        </tr>
                        
                        <%
                        if(room!=null){
                        	%>
                        	<tr id="tr<%=room.getId()%>">
                            <td class="tc"><input data-id="<%=room.getId() %>" class="choose" name="id[]" value="59" type="checkbox"></td>
                            <td><%=1 %></td>
                            <td><%=room.getNumber() %></td>
                            <td><%=room.getRoomtype().getTitle() %></td>
                            <td><%=room.getRoomtype().getPrice() %></td>
                            <td><%=room.getRoomtype().getDiscountPrice() %></td>
                            <td class="check"><span class="checkin"><%=room.getCheckIn() %></span></td>
                            <td style="width:150px;"><a href="<%=path%>/manage/RoomServlet?action=checkinInformation&id=<%=room.getId()%>">显示信息</a></td>
                            <td>
                                <a class="link-update" href="<%=path%>/manage/RoomServlet?action=beforeupdate&id=<%=room.getId()%>">修改</a>
                                <a id="de<%=room.getId() %>" class="link-del" href="javascript:void(0)">删除</a>
                            </td>
                        </tr>
                        	<%
                        }
                        %>
                    </table>
                    </div>
                    <script>
$(function(){
	$("#batchDel").click(function(){
		var ids=[];
		$(".choose:checked").each(function(){
			var id=$(this).data("id");
			ids.push(id);
		});
		if(ids.length>0){
			$.get("<%=path%>/manage/RoomServlet?action=dele",
					{id:ids.toString()},
					function(){
						for(var i=0;i<ids.length;i++){
							$("#tr"+ids[i]).remove();
						}
					}
					)
				}
	})
	$(".checkin").each(function(){
		var check=$(this).html();
		
		if(check=="false"){
			$(this).html("空闲");
		}else if(check=="true"){
			$(this).html("入住");
		} 
	})
	})

</script>